<style>
    body {background-image:url("__AIMAGES__/bg.jpeg");background-size: cover ;background-attachment: fixed ;background-position: center center;}
</style>
<div class="layadmin-user-login layadmin-user-display-show" id="LAY-login-login" style="display: none;">
    <div class="layadmin-user-login-main">
        <div class="layadmin-user-login-box layadmin-user-login-header">
            <h2>后台</h2>
            <p>管理系统</p>
        </div>
        <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-username"
                       for="LAY-login-login-admin_name"></label>
                <input type="text" name="admin_name" id="LAY-login-login-admin_name" lay-verify="required"
                       placeholder="登录账号" class="layui-input">
            </div>
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-password"
                       for="LAY-login-login-password"></label>
                <input type="password" name="password" id="LAY-login-login-password" lay-verify="required"
                       placeholder="登录密码" class="layui-input">
            </div>
            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-xs7">
                        <label class="layadmin-user-login-icon layui-icon layui-icon-vercode"
                               for="LAY-login-login-vercode"></label>
                        <input type="text" name="vercode" id="LAY-login-login-vercode" lay-verify="required"
                               placeholder="图形验证码" class="layui-input">
                    </div>
                    <div class="layui-col-xs5">
                        <div style="margin-left: 10px;" class="echoui-login-captcha">
                            {:captcha_img()}
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-login-login-submit">登 录</button>
            </div>
        </div>
    </div>

    <div class="layui-trans layadmin-user-login-footer">
        <p>© 2019 - {:date('Y')} <a href="{$domain}" target="_blank">{$_SERVER['HTTP_HOST']}</a></p>
        <p> &nbsp; </p>
    </div>
</div>


<script>
    layui.use(['index', 'user'], function () {
        const $ = layui.$;
        const admin = layui.admin;
        const form = layui.form;
        form.render();

        form.on('submit(LAY-login-login-submit)', function (obj) {
            admin.req({
                url: "{:url('login/login')}",
                data: obj.field,
                success: function (res) {
                    if (res.code == 0) {
                        location.href = "{:url('home/index')}";
                    } else {
                        $('.echoui-login-captcha img').click();
                    }
                }
            });
        });
    });
</script>
